<!--
 * @Description: 
 * @Author: mxy
 * @Date: 2022-11-14 20:12:20
 * @LastEditors: mxy
 * @LastEditTime: 2022-11-14 20:36:05
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="./axios.js"></script>
    <script>
        // async用于修饰函数，该函数的返回值就是一个resolve为返回值的的promise对象
        //await下边的代码属于异步微任务
        axios.defaults.baseURL = 'http://www.itcbc.com:3006'
        //获得Promise对象
        let p1 = axios.get('/api/province')
        let p2 = axios.get('/api/city', {
            params: {
                pname: '河南省'
            }
        })
        let p3 = axios.get('/api/county', {
            params: {
                pname: '河南省',
                cname: '新乡市'
            }
        })

        async function aaa() {
            let res1 = await p1
            let res2 = await p2
            let res3 = await p3
            console.log(res1)
            console.log(res2)
            console.log(res3)
        }
        aaa()
    </script>
</body>

</html>